﻿-- ------------------------------------------
-- DESCRIPTION: Create table and insert Sproc 
-- CREATE DATE: 2011-08-20
-- CREATE BY  : Matricis
-- -----------
-- MOFICATION :
-- MODIFY DATE: 
-- MODIFY BY  : 
-- ------------------------------------------

SET ANSI_NULLS ON
GO

IF  EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SyncErrorLog]') AND type in (N'U'))
	DROP TABLE [dbo].[SyncErrorLog]
GO

CREATE TABLE [dbo].[SyncErrorLog](
	[Id] [bigint] IDENTITY(1,1) NOT NULL,
	[ConflitType] [varchar](50) NULL,
	[Message] [varchar](50) NOT NULL,
	[DbConflictDetected] [varchar](50) NULL,
	[EventDateTime] [varchar](25) NULL,
	[Detail] [varchar](max) NULL
) ON [PRIMARY]

GO


IF  EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SyncErrorLog_INSERT]') AND type in (N'P', N'PC'))
	DROP PROCEDURE [dbo].[SyncErrorLog_INSERT]
GO

-- ------------------------------------------
-- DESCRIPTION: Insert Detail of Sync Conflit 
-- CREATE DATE: 2011-08-20
-- CREATE BY  : Matricis
-- -----------
-- MOFICATION :
-- MODIFY DATE: 
-- MODIFY BY  : 
-- ------------------------------------------
CREATE PROCEDURE [dbo].[SyncErrorLog_INSERT]
             @ConflitType varchar(50)
           , @Message varchar(50)
           , @DbConflictDetected varchar(50)
           , @EventDateTime varchar(25)
           , @Detail varchar(MAX)
AS     
	INSERT INTO SyncErrorLog(
		 ConflitType
	   , Message
	   , DbConflictDetected
	   , EventDateTime
	   , Detail
	)
	VALUES(
		 @ConflitType
	   , @Message
	   , @DbConflictDetected
	   , @EventDateTime
	   , @Detail
	)
GO

